import sys

from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QApplication
from qfluentwidgets import CardWidget, PushButton, SearchLineEdit
#这个项目很多模块,只要能从qfluentwidgets中导入,就从qfluentwidget中导入

class StudentInterface(CardWidget):
    def __init__(self):
        super().__init__()
        self.resize(600, 600)
        self.setFixedWidth(600)
        self.vBoxLayout = QVBoxLayout(self)
        self.card_widget=CardWidget(self)
        # self.setObjectName("studentInterface")
        # #self.setup_ui()
        #
        buttons_layout=QHBoxLayout()
        self.vBoxLayout = QVBoxLayout(self)

        self.addButton=PushButton("新增")
        self.addButton.setFixedWidth(100)
        self.searchInput=SearchLineEdit(self)
        self.searchInput.setPlaceholderText("搜索学生姓名或学号......")
        self.searchInput.setFixedWidth(500)
        self.batchDeleteButton=PushButton("批量删除",self)
        self.batchDeleteButton.setFixedWidth(100)

        buttons_layout.addWidget(self.addButton,stretch=1)
        buttons_layout.addWidget(self.searchInput,stretch=1)
        buttons_layout.addWidget(self.batchDeleteButton,stretch=1)
        self.vBoxLayout.addWidget(self.card_widget)

        self.setStyleSheet("StudentInterface {background: pink}")

    # def setup_ui(self):
    #     #
    #     #top button
    #     card_widget=CardWidget(self)#按钮父元素,卡片样式
    #     buttons_layout=QHBoxLayout(card_widget)#它归属于card_widget
    #
    #
    #     self.addButton=PushButton("新增",self)
    #     self.searchInput=SearchLineEdit(self)
    #     self.searchInput.setPlaceholderText("搜索学生姓名或学号......")
    #     self.searchInput.setFixedWidth(500)
    #     self.batchDeleteButton=PushButton("批量删除",self)
    #
    #     buttons_layout.addWidget(self.addButton)
    #     buttons_layout.addWidget(self.searchInput)
    #     buttons_layout.addWidget(self.batchDeleteButton)
    #
    #     layout = QVBoxLayout(self)
    #     layout.addWidget(card_widget)
    #
    #     self.setStyleSheet("StudentInterface {background: white}")#这就是qss样式设置方式


if __name__=='__main__':
    app=QApplication(sys.argv)
    w=StudentInterface()
    w.show()
    sys.exit(app.exec())



























